home *** CD-ROM | disk | FTP | other *** search
/ ASME's Mechanical Engine…ing Toolkit 1997 December / ASME's Mechanical Engineering Toolkit 1997 December.iso / c_lang / pccstdio.lzh / SRC.LZH / INDEX.C < prev    next >
Encoding:
C/C++ Source or Header  |  1984-07-29  |  374 b   |  16 lines

  1. /*    index.c - find first occurrence of character in string.
  2.     (C) Copyright 1984 Gregory R. Mansfield - All Rights Reserved.
  3.     G. R. Mansfield.  84/06/06.
  4.     Ver 1.0-4729.
  5. */
  6.  
  7. #include <defstd.h>
  8.  
  9. char *index(s, c)    /* return pointer to first occurrence of c in s */
  10. char *s, c;    /* NULL if c is not in s */
  11. {
  12.     while (*s && *s != c)
  13.         s++;
  14.     return(*s ? s : NULL);
  15. }
  16.